<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>관리자</title>
<link rel="stylesheet" type="text/css" href="/Public/css/style.css" />
<!-- jQuery file -->
<script src="/Public/js/jquery.js"></script>
<script src="/Public/js/jquery.min.js"></script>
<script src="/Public/js/jquery.tabify.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var $ = jQuery.noConflict();
$(function() {
$('#tabsmenu').tabify();
$(".toggle_container").hide(); 
$(".trigger").click(function(){
	$(this).toggleClass("active").next().slideToggle("slow");
	return false;
});
});
</script>
</head>
<body>
<div id="panelwrap">
  	
	<div class="header">
    <div class="title"><a href="#">관리자</a></div>
    
    <div class="header_right">Welcome <?php echo ($outid); ?>,  <a href="<?php echo U('logout');?>" class="logout">Logout</a> </div>
               
    <div class="center_content">  
 
    <div id="right_wrap">
    


<div id="right_content">
<script src="/Public/laydate/laydate.js"></script>
<script src="/Public/js/jquery.js"></script>
<script>
laydate.skin("danlan");  //加载皮肤，参数lib为皮肤名
var dt2 = {
    elem: '#dt2',
    format: 'YYYY/MM/DD hh:mm:ss',
    max: laydate.now(), //设定最dd日期为当前日期
    istime: true,
    istoday: false
};
laydate(dt2);
</script>

<script type="text/javascript">
	function  dtsearch(){
		//alert("ssss");
		var gameurl="";
		if(document.getElementsByName("baduki")[0].checked){
			//alert("baduki");
			gameurl+="&baduki=1";
		}
		if(document.getElementsByName("toto")[0].checked){
			//alert("baduki");
			gameurl+="&toto=1";
		}
		if(document.getElementsByName("baccart")[0].checked){
			//alert("baduki");
			gameurl+="&baccart=1";
		}
		var temp=document.getElementsByName("astime");
		for (i=0;i<temp.length;i++){
	  //遍历Radio
	   		if(temp[i].checked){
				//alert("你选择了"+temp[i].value);
				gameurl+="&astime="+temp[i].value;
			}
		}
		gameurl+="&tel="+document.getElementsByName("tel")[0].value;
		//alert(gameurl);
		window.location.href="<?php echo U('Home/Customer/showCustomerList/p/1');?>/kfid/" + document.getElementsByName("kfid")[0].value + "&level=" + document.getElementsByName("level")[0].value + gameurl + "&dt1="+ document.getElementsByName("dt1")[0].value+ "&dt2=" + document.getElementsByName("dt2")[0].value; 
			
		//window.navigate("target.aspx");
	}
	
	function  changeOwner(){
		//alert(11111);
		var f = document.createElement("form");
		document.body.appendChild(f);
		
		var i,j=0; 
		var osel=document.getElementsByName('ckbox');
		for (i=0;i<osel.length;i++) { 
			if (osel[i].checked) {
				j=1;
				var inp = document.createElement("input");
				inp.type = "hidden";
				inp.name="tel[]";
				inp.value = osel[i].value;
				f.appendChild(inp);
			}
		}
//		var obj=document.getElementsByName('uid');
//		var index = obj.selectedIndex; // 选中索引
//		var value = obj.options[index].value; // 选中值

		var inp = document.createElement("input");
		inp.type = "hidden";
		inp.name = "ownid";
		inp.value = document.getElementById("sluid").value;
		f.appendChild(inp);
		
		if(j==1){
			f.action = "<?php echo U('changeCustomerOwner');?>";
			f.method = "post";
			f.submit();
		}
	}
	function  downloadAllXLS(){
		//alert(window.location.href);
		var url = window.location.href; //获取url中"?"符后的字串
		//alert(url);
		var ip=url.indexOf("/p/");//先找到P的位置
		if (ip != -1) {
			var ip2=url.indexOf("/",ip+3);//从/p/的位置后找/
			var str = url.substr(ip2,url.length);
			//alert(str);
			window.location.href="<?php echo U('Home/Customer/downloadAllXLS');?>"+str;
		}
	}
	function  downloadXLS(){
		//alert(11111);
		var f = document.createElement("form");
		document.body.appendChild(f);
		
		var i,j=0; 
		var osel=document.getElementsByName('ckbox');
		for (i=0;i<osel.length;i++) { 
			if (osel[i].checked) {
				j=1;
				var inp = document.createElement("input");
				inp.type = "hidden";
				inp.name="tel[]";
				inp.value = osel[i].value;
				f.appendChild(inp);
			}
		}
//		var obj=document.getElementsByName('uid');
//		var index = obj.selectedIndex; // 选中索引
//		var value = obj.options[index].value; // 选中值

/*		var inp = document.createElement("input");
		inp.type = "hidden";
		inp.name = "ownid";
		inp.value = document.getElementById("sluid").value;
		f.appendChild(inp);*/
		
		if(j==1){
			f.action = "<?php echo U('downloadXLS');?>";
			f.method = "post";
			f.submit();
		}
	}
	

</script>
<script type="text/javascript">
	function  deleteCustomer(){
		//alert(11111);
		var f = document.createElement("form");
		document.body.appendChild(f);
		
		var i,j=0; 
		var osel=document.getElementsByName('ckbox');
		for (i=0;i<osel.length;i++) { 
			if (osel[i].checked) {
				j=1;
				var inp = document.createElement("input");
				inp.type = "hidden";
				inp.name="tel[]";
				inp.value = osel[i].value;
				f.appendChild(inp);
			}
		}
	
		if(j==1){
			f.action = "<?php echo U('deleteSeletcCustomer');?>";
			f.method = "post";
			f.submit();
		}
	}
</script>
<script type="text/javascript">
  
	jQuery(function($) {
						
		//alert(2222);
		$('#SelectAll').on('click' , function(){
			//alert(1111111);
			var that = this;
			$(this).closest('table').find('tr > td:first-child input:checkbox')
			.each(function(){
				this.checked = that.checked;
				$(this).closest('tr').toggleClass('selected');
			});
				
		});
	
	
	})
</script>

 <h2>회원 리스트</h2>
  조회시작일:
  <input name="dt1" class="laydate-icon" id="dt1" onClick="laydate()">
  조회종료일:
  <input name="dt2" class="laydate-icon" id="dt2" onClick="laydate()">
  &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="astime" value="1" />regTime
  &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="astime" value="2" />lastCallTime
  <br>
  level:<select class="" name="level">
          <option value="" selected ></option>
          <option value="0" >0</option>
          <option value="1" >레벨1 문자전송</option>
          <option value="2" >레벨2 재전화요망</option>
          <option value="3" >레벨3 부재중</option>
          <option value="4" >레벨4 게임안함</option>
          <option value="5" >레벨5 매장,총판 원하는 유저</option>
          <option value="6" >레벨6 delete</option>
          
        </select>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    user:<select  name="kfid" id="kfid" style="width:100px;" >
    		<option value=""></option>
          <?php if(is_array($userlist)): foreach($userlist as $key=>$v): ?><option value="<?php echo ($v["uid"]); ?>"><?php echo ($v["uname"]); ?></option><?php endforeach; endif; ?>
        </select>
        &nbsp;&nbsp;&nbsp;&nbsp;<input name="baduki" type="checkbox" value="1" />바둑이
        &nbsp;&nbsp;&nbsp;&nbsp;<input name="toto" type="checkbox" value="1"/>토토
        &nbsp;&nbsp;&nbsp;&nbsp;<input name="baccart" type="checkbox" value="1"/>바카라 
        <br>
        Tel:
  		<input name="tel" class="" id="tel" >
  		&nbsp;&nbsp;&nbsp;&nbsp;       
  <a href="#" onclick="dtsearch()" style="font-size:20px;font-weight:bold; width:200px;"> 검색</a>
  <table id="rounded-corner">
    <thead>
      <tr>
        <th width="50"><input type="checkbox" name="input" id="SelectAll" /></th>
        <th width="90">이름</th>
        <th width="130">전화번호</th>
        <th width="50">레벨</th>
        <th width="200">등록일자</th>
        <th width="200">마지막 통화시간</th>
        <th width="91">편집</th>
        <th width="56">회원정보</th>
        <th width="48">통화기록</th>
      </tr>
    </thead>
    <tfoot>
      <tr>
        <td colspan="12"></td>
      </tr>
    </tfoot>
    <form action="<?php echo U('changeCustomerOwner');?>" method="post" name="changeCustomerOwner">
    <tbody>
      <td height="6"><?php if(is_array($list)): foreach($list as $key=>$v): if((($v["id"] % 2) == 1) ): ?><tr class="odd">
        <?php else: ?>
    <tr class="even"><?php endif; ?>
        
      <td><input type="checkbox" name="ckbox" id="<?php echo ($v["tel"]); ?>" value="<?php echo ($v["tel"]); ?>" /></td>
      <td><?php echo ($v["name"]); ?></td>
            <td><?php echo ($v["tel"]); ?></td>
            <td><?php echo ($v["level"]); ?></td>
            <td><?php echo ($v["addtime"]); ?></td>
            <td><?php echo ($v["lasttime"]); ?></td>
            <td><?php echo ($v["uid"]); ?></td>
            <td><a href="<?php echo U('Home/Customer/editCustomer/');?>/id/<?php echo ($v["id"]); ?>"><img src="/Public/images/edit.png" alt="" title="" border="0" /></a></td>
            <td width="16"><a href="<?php echo U('Home/Customer/callCustomer/');?>/id/<?php echo ($v["id"]); ?>"><img src="/Public/images/edit.png" alt="" title="" border="0" /></a></td>
   	</tr>
        <!-- <th><?php echo (date('y-m-d H:i',$v["addtime"])); ?></th>--><?php endforeach; endif; ?>

    </tbody>
  </table>
  <div class="meneame"><?php echo ($page); ?></div>
  
  <div>
        <select  name="sluid" id="sluid" style="width:100px;" >
          <?php if(is_array($userlist)): foreach($userlist as $key=>$v): ?><option value="<?php echo ($v["uid"]); ?>"><?php echo ($v["uname"]); ?></option><?php endforeach; endif; ?>
        </select>
  	<a href="#" onclick="changeOwner()"  >고객이동</a>  </div>
  </form>
  <br>
  <div class="form_sub_buttons">
  	<a href="#" class="button green" onclick="downloadXLS()">고객다운</a>
  	<a href="#" class="button green" onclick="downloadAllXLS()">DownloadAll</a>
  	<a href="#" class="button red" onclick="deleteCustomer()">delete</a>
  	<!--<a href="#" class="button red">Delete selected</a>-->
 </div>
  <!--<div class="toogle_wrap"></div>-->
 
</div>

 


    </div>
    <!-- end of right content-->
                     
                    
    <div class="sidebar" id="sidebar">
    <h2>Customer Admin</h2>
    
        <ul>
            <li><a href="<?php echo U('Home/Customer/showCustomerList/p/1');?>">회원 리스트</a></li>
            <li><a href="<?php echo U('Home/Customer/uploadCustomer');?>">Customer upload</a></li>
            <li><a href="#">test</a></li>
        </ul>
    <h2>User Admin</h2>
    
        <ul>
            <li><a href="<?php echo U('Home/Customer/showUserList/p/1');?>">회원 목록</a></li>
        </ul> 
        
    <h2>My</h2>
    
        <ul>
            <li><a href="#">바뀐 비밀번호</a></li>
        </ul> 
        
       
    <h2>Text Section</h2> 
    <div class="sidebar_section_text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    </div>         
    
    </div>             
    
    
    <div class="clear"></div>
    </div> <!--end of center_content-->
    
    <div class="footer">
Panelo - Free Admin Collect from</div>

</div>

    	
</body>
</html>